javascript style background color

54

javascript change background color -

document.body.style.backgroundColor = "yellow";

how to change background color using js -

var warning = document.getElementById("warning");
  warning.style.background-color = "red";

how to change the background color of html in javascript -

document.querySelector('html').style.backgroundColor = 'red';

document.body.style.background -

// Change the background color to red
document.body.style.backgroundColor = "red"; 

Comments

Submit
0 Comments